// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
	env: cloud.DYNAMIC_CURRENT_ENV
})
const db = cloud.database()
const _ = db.command

// 云函数入口函数
exports.main = async (event, context) => {
	  const orderId = event.outTradeNo
	  const openid = event.userInfo.openId
	  const returnCode = event.returnCode
	  const cashFee = event.cashFee
	  await db.collection('test').add({
		  data:event
	  })
	  if(returnCode == 'SUCCESS'){
	    const res = {errcode:0,errmsg:''}//需要返回的字段，不返回该字段则一直回调
	    return res
	  }
	
}
